package com.study.happystudy.service.impl;

import com.study.happystudy.mapper.LeaveNoteMapper;
import com.study.happystudy.po.LeaveNote;
import com.study.happystudy.service.LeaveNoteService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LeaveNoteServiceImpl implements LeaveNoteService {
    @Resource
    LeaveNoteMapper leaveNoteMapper;
    @Override
    public void insertLeaveNote(int userId, int courseId, String startTime, String endTime,String reason) {
        leaveNoteMapper.insertLeaveNote(userId,courseId,startTime,endTime,reason);
    }

    @Override
    public LeaveNote getLeaveNoteById(int id) {
        return leaveNoteMapper.getLeaveNoteById(id);
    }

    @Override
    public void deleteLeaveNoteById(int id) {
        leaveNoteMapper.deleteLeaveNoteById(id);
    }

    @Override
    public List<LeaveNote> getLeaveNotesByCourseId(int courseId) {
        return leaveNoteMapper.getLeaveNotesByCourseId(courseId);
    }

    @Override
    public List<LeaveNote> getFutureLeaveNotesByCourseIdAndStatus(int courseId, String approved) {
        return leaveNoteMapper.getFutureLeaveNotesByCourseIdAndStatus(courseId,approved);
    }

    @Override
    public List<LeaveNote> getPastLeaveNotesByCourseIdAndStatus(int courseId, String approved) {
        return leaveNoteMapper.getPastLeaveNotesByCourseIdAndStatus(courseId,approved);
    }

    @Override
    public List<LeaveNote> getFutureLeaveNotesByCourseId(int courseId) {
        return leaveNoteMapper.getFutureLeaveNotesByCourseId(courseId);
    }

    @Override
    public List<LeaveNote> getPastLeaveNotesByCourseId(int courseId) {
        return leaveNoteMapper.getPastLeaveNotesByCourseId(courseId);
    }

    @Override
    public void updateLeaveNote(String approved, int id) {
        leaveNoteMapper.updateLeaveNote(approved,id);
    }

    public List<LeaveNote> getLeaveNotesByCourseIdAndStatus(int courseId, String status){
        return leaveNoteMapper.getLeaveNotesByCourseIdAndStatus(courseId,status);
    }
}
